package org.zxyj.core.entity;

import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.Date;

import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * 数据基础模型
 * 
 * @author zhaoyong
 * @version 2016年2月18日
 */
public abstract class BaseEntity<T> implements Serializable {

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = -3946298576536447239L;

	/**
	 * 实体编号
	 */
	protected Long id;

	/**
	 * 排序
	 */
	protected Integer sortNo;

	/**
	 * 数据创建时间
	 */
	protected Date createTime;

	/**
	 * 数据更新时间
	 */
	protected Date updateTime;

	/**
	 * 备注
	 */
	protected String remarks;

	@Override
	public String toString() {
		return (new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) {
			protected boolean accept(Field f) {
				// 排除password等安全性数据
				return super.accept(f) && !f.getName().equals("password");
			}
		}).toString();
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Integer getSortNo() {
		return sortNo;
	}

	public void setSortNo(Integer sortNo) {
		this.sortNo = sortNo;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

}